#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <sstream>
#include<string>

using namespace std;

int main(int argc, char **argv)
{

    char line[1024 * 16];
    int countlines = 0;

    int t1 = time(NULL);

    FILE *fp = fopen("/devlops/test.txt", "r");
    if (fp == NULL)
    {
        perror("open file error");
        exit(1);
    }

    while (1)
    {

        if (fgets(line, sizeof(line), fp) == NULL)
        {
            printf(" read text is end \n");
            break;
        }
        countlines++;
         printf(" %s \n",line);
        stringstream stream(line);
        string num;
        while(getline(stream,num,',')){
            cout<<num<<endl;
        }
        
         
    }

    printf(" 文本行数: %d \n", countlines);
    int t2 = time(NULL);
    int aa = t2 - t1;
    printf(" 使用的时间为： %d \n", aa);

    return 0;
}